
// 顶点结构
struct Vertex {
    // 从顶点缓冲区获取顶点数据
    @location(0) position: vec2f,
    @location(1) color: vec4f,
    @location(2) offset: vec2f,
    @location(3) scale: vec2f,
    @location(4) vertColor: vec3f, // 顶点颜色
};

struct VSoutput{
    @builtin(position) position: vec4f,
    @location(0) color: vec4f,
};

@vertex fn vs(
    vert: Vertex
) -> VSoutput {
    var output: VSoutput;
    output.position = vec4f (vert.position * vert.scale + vert.offset, 0.0, 1.0);
    output.color = vert.color * vec4f(vert.vertColor, 1.0);
    return output;
}

// 通过inner-stage变量传递
@fragment fn fs(input: VSoutput) -> @location(0) vec4f {
    return input.color;
}
